package com.nowcoder.community;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.PostConstruct;
import java.lang.management.ManagementFactory;

@SpringBootApplication
public class CommunityApplication {
    //  防止redis与es的netty冲突(Netty4Utils.setAvailableProcessors())
    @PostConstruct
    public void init(){
        System.setProperty("es.set.netty.runtime.available.processors","false");
    }

    public static void main(String[] args) {
        SpringApplication.run(CommunityApplication.class, args);
        while(true){
            System.out.println("Total Number of threads " + ManagementFactory.getThreadMXBean().getThreadCount());
            try{
                Thread.sleep(300000L);
            }catch(InterruptedException e){
                e.printStackTrace();
            }
        }
    }

}
